import wepy from 'wepy'

export default class extends wepy.mixin {
    data = {
        //民宿列表
        homelist: [],
        //评分
        score: 5
    }

    onLoad() {
        this.getHomeList()
    }

    async getHomeList() {
        const { data:res } = await wepy.request({
            url:'http://minsu.xiaoxingzi028.com/homestay/index',
            method: 'POST',
            data: {
                page: 1,
                limit: 10,
                lng: 30.659849229051527,
                lat: 107.5341796875,
                gap: 'asc',
                price: 'asc',
                score: 'desc'
            }
        })
        if(res.msg !== 'OK') {
            wepy.showToast({
                title: '获取民宿列表失败',
                icon: 'none',
                duration: 2000
            })
            return
        }
        this.homelist = res.data
        this.$apply()
        console.log(this.homelist)
        
    }
    
    methods = {
        
    }
}